<?php
class ParameterManager {
	
	private static $_instance;
	private static $_params;
	
	private function __construct() {
		$this->params = array();
	}
	
	public static function getInstance() {
		if(is_null(self::$_instance)) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	public function getParams() {
		$_params['control']= self::getParam('control');
		$_params['action']= self::getParam('action');
		$_params['args']= self::getParam('args');
		return $_params;
	}
	
	public function getParam($key) {
		return self::getQuery($key);
	}
	
	public function getPost($key) {
		if(isset($_POST[$key]) && !empty($_POST[$key]))
			return $_POST[$key];
		return NULL;
	}
	
	public function getQuery($key) {
		if(isset($_GET[$key]) && !empty($_GET[$key]))
			return $_GET[$key];
		return NULL;
	}
	
	public function getSessionVariable($key) {
		if(isset($_SESSION[$key]) && !empty($_SESSION[$key]))
			return $_SESSION[$key];
		return NULL;
	}
	
	public function setSessionVariable($key, $value) {
		$_SESSION[$key] = $value;
	}
	
	public function setUserSessionVariable($key,$value) {
		$_SESSION['user']['values:protected'][$key] = $value;
	}
}